package com.example.gamestore.control;

import com.example.gamestore.Bean.User;
import com.example.gamestore.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

@Controller
public class IndexTableControl {
    @Autowired
    private UserMapper userMapper;
    @GetMapping("/register")
    public String Register(){
        System.out.println(1);
        return "register";
    }

    @GetMapping("/index1")

    public String index1(HttpSession session){
        User user =(User) session.getAttribute("user");
        if(user!=null){
            User user1 = userMapper.selectById(user.getId());
            session.setAttribute("user",user1);
        }
        return "index1";
    }

    @GetMapping("/index2")
    public String index2(){
        return "index-2";
    }

    @GetMapping("/index3")
    public String index3(){
        return "index-3";
    }

    @GetMapping("/index4")
    public String index4(){
        return "index-4";
    }

    @GetMapping("/index5")
    public String index5(){
        return "index-5";
    }

    @GetMapping("/index-landing")
    public String indexlanding(){
        return "index-landing";
    }

    @GetMapping("/1")
    public String one(){
        return "Test/Test";
    }
    @GetMapping("/2")
    public String two(){
        return "ChongZhi/chongzhi";
    }
}
